﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using MegavaniaX.World;

namespace MegavaniaX.Actors.States
{
    /// <summary>
    /// Base state class for a generic object.  Just moves X + Y positions.
    /// </summary>
    public class GenericObjectStateBase : IState
    {
        protected Actor _actor;
        protected IState _substate;

        public virtual IState NextState
        {
            get;
            protected set;
        }

        public GenericObjectStateBase(Actor actor)
        {
            _actor = actor;
        }

        public virtual void AddSubstate(IState substate)
        {
            _substate = substate;
        }

        public virtual void OnEnter()
        {

        }

        public virtual bool Update(TimeSpan elapsedtime, Screen screen)
        {
            _actor.position.X += _actor.velocity.X * elapsedtime.Milliseconds;
            _actor.position.Y += _actor.velocity.Y * elapsedtime.Milliseconds;
                

            return false;
        }

        public virtual void OnExit()
        {

        }

        public virtual bool CanHandleEvent(MegavaniaEventType evt)
        {
            return false;
        }

        public virtual bool HandleEvent(IMegavaniaEvent evt)
        {
            return false;
        }
    }
}
